HTMLify
index.html
Views: 351 | Author: cody
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <title>Add To Cart Interaction</title> <meta name='viewport' content='width=device-width, initial-scale=1'> <link rel='stylesheet' type='text/css' media='screen' href='style.css'> </head> <body> <button class="button"> <span>Add to cart</span> <div class="cart"> <svg viewBox="0 0 36 26"> <polyline points="1 2.5 6 2.5 10 18.5 25.5 18.5 28.5 7.5 7.5 7.5"></polyline> <polyline points="15 13.5 17 15.5 22 10.5"></polyline> </svg> </div> </button> <script> document.querySelectorAll(".button").forEach((button) => button.addEventListener("click", (e) => { if (!button.classList.contains("loading")) { button.classList.add("loading"); setTimeout(() => button.classList.remove("loading"), 3700); } e.preventDefault(); }) ); </script> </body> </html> |